package com.jac.alapores.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.googlecode.objectify.ObjectifyService;
import com.jac.alapores.domain.Alapores;
import com.jac.alapores.domain.AlaporesCategory;
import com.jac.alapores.domain.AlaporesHero;
import com.jac.alapores.domain.BattleLogs;
import com.jac.alapores.domain.AlaporesOptions;
import com.jac.alapores.domain.Territory;
import com.jac.alapores.domain.User;
import com.jac.alapores.manager.AlaporesManager;

/**
 */
public final class ContextInitializer 
implements ServletContextListener 
{
    @Override
    public void contextInitialized(final ServletContextEvent sce) 
    {
        ObjectifyService.register(Alapores.class);
        ObjectifyService.register(AlaporesHero.class);
        ObjectifyService.register(AlaporesCategory.class);
        ObjectifyService.register(AlaporesOptions.class);
        ObjectifyService.register(BattleLogs.class);
        ObjectifyService.register(Territory.class);
        ObjectifyService.register(User.class);
        
        AlaporesManager manager = new AlaporesManager();
        manager.bootStrapCategories();
    }

    @Override
    public void contextDestroyed(final ServletContextEvent sce) 
    {
        // empty
    }
}
